package com.ran.mvpdemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import com.ran.mvpdemo.model.Model;import com.ran.mvpdemo.presenter.MainPresenter;
import com.ran.mvpdemo.view.MainView;


public class MainActivity extends AppCompatActivity implements MainView<Model> {
    private static final String TAG=MainActivity.class.getSimpleName();

    private MainPresenter mainPresenter;
    private TextView textview;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
    }

    @Override
    public void initView() {
        textview = (TextView) findViewById(R.id.textView);
        mainPresenter = new MainPresenter(this);
        mainPresenter.loadData();
    }

    @Override
    public void showData(Model model) {
        Log.d(TAG,"showData()");
        textview.setText(model.getName());
    }
}
